<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="./jquery.js"></script>
    <link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="./bootstrap/css/bootstrap-theme.min.css">
    <script src="./bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="./css/needs_list.css">
    <script src="./js/paging.js"></script>

</head>

<body>
 <jsp:include page="./head.jsp"></jsp:include>

    <div id="content_container">
        <div class="needs_list">
            <c:forEach items="${needsList}" var="need" varStatus="status">
            <div class="needs_item clearfix">
                <img src="./img/head.jpg" alt="">
                <div class="content">
                    <h4><b>${need.title}</b></h4>
                    <p>${need.describe}</p>
                </div>
                <div class="contact">
                    <p>QQ:${need.user.qq}</p>
                    <p>Tel:${need.user.phonenumber}</p>
                </div>
                <div class="time">
                    <p>${need.time}</p>
                </div>
            </div>
            </c:forEach>
          

        </div>
        <div id="bottom_page">
            <input id="pageNow" type="hidden" value="${pageNow}">
            <nav>
            <%int sum=(Integer)(request.getAttribute("sum"));
            int pageN=(Integer)(request.getAttribute("pageNow")); 
            int pageP=pageN-1;
            int pageL=pageN+1;
            %>
                <ul class="pagination">
                    <li class="disabled"><a id="one"  href="needs!getPageNeeds.action?pageNow=<%=pageP%>" aria-label="Next"><span aria-hidden="true"> « </span></a>
                    </li>
                    <%
                      for(int i=1;i<=sum;i++){
                    %>
                    <li class="active"><a href="needs!getPageNeeds.action?pageNow=<%=i%>"><%=i%><span class="sr-only">(current)</span></a></li>
                    <%}%>
                    <li class=""><a id="two" href="needs!getPageNeeds.action?pageNow=<%=pageL%>" aria-label="Next"><span  aria-hidden="true"> » </span></a></li>
                </ul>
            </nav>

        </div>

    </div>

</body>
</html>
